﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace ICE.Vacations.Helper
{
    public static class ConfigApp
    {
        #region Global Resources

        public static string IIFDomain { get; set; }
        public static string IIFUser { get; set; }
        public static string IIFPassword { get; set; }

        public static string docClass { get; set; }
        public static string inputQueue { get; set; }

        public static string logLocation { get; set; }
        public static int logMaxSizeBytes { get; set; }
        public static string logPrefix { get; set; }

        public static string RRHH_DataBase { get; set; }
        public static string RRHH_User { get; set; }
        public static string RRHH_Password { get; set; }

        public static string SQL_Server { get; set; }
        public static string SQL_DataBase { get; set; }
        public static string SQL_User { get; set; }
        public static string SQL_Password { get; set; }

        public static string signExecuteName { get; set; }
        public static string signExecutePath { get; set; }

        public static bool ConfigurationError { get; set; }
        public static bool DBError { get; set; }
        public static bool IIFError { get; set; }
        public static bool SuccessMessage { get; set; }
        public static bool InformationMessage { get; set; }

        #endregion


        public static void LoadConfig()
        {
            Services.Services.sendLog("Cargando Configuracion", Services.Services.errorType.InformationMessage);
            try
            {

                ConfigApp.IIFDomain = ConfigurationManager.AppSettings["IIFDomain"].ToString();
                ConfigApp.IIFUser = ConfigurationManager.AppSettings["IIFUser"].ToString();
                ConfigApp.IIFPassword = ConfigurationManager.AppSettings["IIFPassword"].ToString();

                ConfigApp.docClass = ConfigurationManager.AppSettings["docClass"].ToString();
                ConfigApp.inputQueue = ConfigurationManager.AppSettings["inputQueue"].ToString();

                ConfigApp.logLocation = ConfigurationManager.AppSettings["logLocation"].ToString();
                ConfigApp.logMaxSizeBytes = Convert.ToInt32(ConfigurationManager.AppSettings["logMaxSizeBytes"].ToString());
                ConfigApp.logPrefix = ConfigurationManager.AppSettings["logPrefix"].ToString();

                ConfigApp.RRHH_DataBase = ConfigurationManager.AppSettings["RRHH_DataBase"].ToString();
                ConfigApp.RRHH_User = ConfigurationManager.AppSettings["RRHH_User"].ToString();
                ConfigApp.RRHH_Password = ConfigurationManager.AppSettings["RRHH_Password"].ToString();

                Services.Services.sendLog("SERVIDOR SQL: " + ConfigurationManager.AppSettings["SQL_Server"].ToString(), Services.Services.errorType.InformationMessage);
                ConfigApp.SQL_Server = ConfigurationManager.AppSettings["SQL_Server"].ToString();
                ConfigApp.SQL_DataBase = ConfigurationManager.AppSettings["SQL_DataBase"].ToString();
                ConfigApp.SQL_User = ConfigurationManager.AppSettings["SQL_User"].ToString();
                ConfigApp.SQL_Password = ConfigurationManager.AppSettings["SQL_Password"].ToString();

                ConfigApp.signExecuteName = ConfigurationManager.AppSettings["signExecuteName"].ToString();
                ConfigApp.signExecutePath = ConfigurationManager.AppSettings["signExecutePath"].ToString();

                ConfigApp.ConfigurationError = Convert.ToBoolean(ConfigurationManager.AppSettings["ConfigurationError"].ToString());
                ConfigApp.DBError = Convert.ToBoolean(ConfigurationManager.AppSettings["DBError"].ToString());
                ConfigApp.IIFError = Convert.ToBoolean(ConfigurationManager.AppSettings["IIFError"].ToString());
                ConfigApp.SuccessMessage = Convert.ToBoolean(ConfigurationManager.AppSettings["SuccessMessage"].ToString());
                //ConfigApp.InformationMessage = Convert.ToBoolean(ConfigurationManager.AppSettings["InformationMessage"].ToString());
            }
            catch (Exception exc)
            {
                //throw (exc);
            Services.Services.sendLog("Ocurrió un error: "+ exc.Message,Services.Services.errorType.InformationMessage); 
               
                
            }
        }



    }
}
